<#include "../../common/meta.ftl">
	<script>
		function selectPic(id){
            $('#'+id).click();
        }
        var count=0;
		function readFile(id){
			var reader = new FileReader();
			var file=document.getElementById(id).files[0];
	        reader.onload = function(e) {
	            var img=document.getElementById(id+'View');
	            img.src=e.target.result+'';
	            img.onload=function(e){
	            }
			    
			}
			count++;
            reader.readAsDataURL(file);
            if(count>=3){
            	document.getElementById("button").disabled=false;
            }
        }
	</script>
	<style>
		.w190{width:270px;heiht:300px}
		.adsView{min-height: 300px;}
		.imgWrap{position:relative;margin-left:2px;margin-right:2px;z-index:90;float:left;}
		.imgWrap .bg1{position:absolute;right:-3px;bottom:-3px;background-color:#E3E3E3;width:100%;height:100%;z-index:91;}
		.imgWrap .bg2{position:absolute;left:-3px;top:-3px;background-color:#fff;width:100%;height:100%;border:1px solid #E3E3E3;z-index:92;}
		.imgWrap .imgDiv{width:100%;height:100%;position:relative;z-index:98;}
		.imgWrap .imgDiv div{width:100%;height:100%;padding:10px 13px 13px 7px;}
		.imgWrap .imgDiv div img{width:250px;height:250px}
		.imgWrap .info{position:relative;z-index:99;padding:10px;}
	</style>
</head>
<body>
	<input id="ctxPath" value="${ctx.contextPath}" type="hidden" />
	
	<div class="head">
		<div class="path">宣传管理 &gt; 广告位管理</div>
	</div>
	<div class="contents">
		<form id="bookForm" action="${ctx.contextPath}/rest/config/ads/save"   enctype="multipart/form-data" method="POST">
		<div class="adsView">
			<#if dict??>
				 <#list dict.value?split(",") as val >
                        <div class="imgWrap w190">
						     <div class="bg1"></div>
						     <div class="bg2"></div>
						     <div class="imgDiv">
						      	<div><a href="#"><img id='ads${val_index+1}View'  onclick='selectPic("ads${val_index+1}")'  src="${ctx.contextPath}${val}" onError='${ctx.contextPath}/images/default/ads1.jpg' /></a></div>
						     </div>
					    </div>
				</#list>
			<#else>
				<div class="imgWrap w190">
			     <div class="bg1"></div>
			     <div class="bg2"></div>
			     <div class="imgDiv">
			      <div><a href="#"><img alt='点击换图' id='ads1View' src="<#if mc??>${mc.configValue!''}<#else>${ctx.contextPath}/images/default/ads1.jpg</#if>" onclick='selectPic("ads1")' onError='${ctx.contextPath}/images/default/ads1.jpg' /></a></div>
			     </div>
			    </div>
				<div class="imgWrap w190">
			     <div class="bg1"></div>
			     <div class="bg2"></div>
			     <div class="imgDiv">
			      <div><a href="#"><img alt='点击换图' id='ads2View' src="<#if mc??>${mc.configValue!''}<#else>${ctx.contextPath}/images/default/ads2.jpg</#if>" onclick='selectPic("ads2")' onError='${ctx.contextPath}/images/default/ads2.jpg' /></a></div>
			     </div>
			    </div>
				<div class="imgWrap w190">
			     <div class="bg1"></div>
			     <div class="bg2"></div>
			     <div class="imgDiv">
			      <div><a href="#"><img alt='点击换图' id='ads3View' src="<#if mc??>${mc.configValue!''}<#else>${ctx.contextPath}/images/default/ads3.jpg</#if>" onclick='selectPic("ads3")' onError='${ctx.contextPath}/images/default/ads3.jpg' /></a></div>
			     </div>
			    </div>
			</#if>
		</div>
		<input type='file' onchange='readFile("ads1")' id='ads1' name='ads1' style='display:none'>
		<input type='file' onchange='readFile("ads2")' name='ads2' id='ads2' style='display:none'>
		<input type='file' onchange='readFile("ads3")' name='ads3' id='ads3' style='display:none'>
		<br/><input type='submit' style='display:block;' id='button' disabled='true' value='保存' >
	</form>
	</div>
</body>
</html>
			

